﻿<UserControl x:Class="LiSAClient.WpfClient.View.Projects.ProjectDetails"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="1100" d:DesignWidth="700" MinWidth="700">
    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>


            <!--Description-->
            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <!--Process buttons-->
                <StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="1">
                    <StackPanel Orientation="Horizontal">
                        <Button Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding WorkOnProjectCmd}" TabIndex="3" Content="Work on project" Width="180"/>
                        <Button Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding RemoveBadArticles}" TabIndex="4" Content="Remove articles voted Out" Width="180"/>
                        <Button Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding ViewStageResults}" TabIndex="5" Content="Stage Results"  Width="150"/>
                        <Button Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding AddBibtexFile}" TabIndex="6" Content="Add BibTex File"  Width="150"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Button Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding GenerateReport}" TabIndex="7" Content="Generate Meta Report" Width="150" />
                        <Button Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding GenerateFullReport}" TabIndex="8" Content="Generate Full Report" Width="150"/>
                        <Button Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding DownloadBibtexFile}" TabIndex="8" Content="Download BibTex File" Width="150"/>
                    </StackPanel>
                </StackPanel>
                <!--Title-->
                <Label Grid.Column="0" Grid.Row="2" Content="Title" Style="{StaticResource InformationCaption}"/>
                <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding Project.Title}" Style="{StaticResource EditableTextBox}" IsReadOnly="True"/>

                <!--Description-->
                <Label Grid.Column="0" Grid.Row="3" Content="Description" Style="{StaticResource InformationCaption}"/>
                <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding Project.Description}" Style="{StaticResource EditableTextBox}" IsReadOnly="True"/>

                <!--Add Bibtex-->
                <Label Grid.Column="0" Grid.Row="4" Content="Add BibTex" Style="{StaticResource InformationCaption}"/>
                <TextBox Grid.Column="1" Grid.Row="4" Text="{Binding BibTexString, UpdateSourceTrigger=LostFocus}" VerticalContentAlignment="Top" Style="{StaticResource EditableTextBox}" TabIndex="1" AcceptsReturn="True" Height="100"/>

                <!--SubmitButton-->
                <StackPanel Orientation="Horizontal" Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left">
                    <Button  Name="ButtonAddBibtex" Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding AddBibtexString}" TabIndex="2" Content="Add Bibtex" IsDefault="True" />
                </StackPanel>
                <Button  Grid.Row="5" Grid.Column="1" Name="ButtonEditMetainformation" Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding EditProjectMetainformation}" TabIndex="2" Content="Edit Info"  />
            </Grid>
            <!--Display added criteria-->
            <Label Grid.Row="1" Content="Project Criteria" Style="{StaticResource InformationCaption}" HorizontalAlignment="Left"/>
            <Button Grid.Row="1" Name="ButtonEditCriteria" Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding EditProjectCriteria}" TabIndex="3" Content="Edit Criteria" />

            <DataGrid Grid.Row="2" Name="CriteriaDataGrid" ItemsSource="{Binding Project.Criteria}"  Style="{StaticResource DataGridStyle}" Width="{Binding ElementName=Grid, Path=ActualWidth}"
                      AutoGenerateColumns="False" IsReadOnly="True" IsSynchronizedWithCurrentItem="True" SelectionMode="Single" SelectionUnit="FullRow" >
                <DataGrid.Columns>
                    <DataGridTextColumn Width="Auto" MinWidth="125" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding CriteriaID}" Header="ID" ElementStyle="{StaticResource DataGridTextColumnElementStyle}" />
                    <DataGridTextColumn Width="*" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding Description}" Header="Description" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                    <DataGridTextColumn Width="Auto" MinWidth="125" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding IsInclusion, Converter={StaticResource BoolToInclusionConverter}}" Header="Inclusion?" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                </DataGrid.Columns>
            </DataGrid>

            <!--Display added users-->
            <Label Grid.Row="3" Content="Project Members" Style="{StaticResource InformationCaption}" HorizontalAlignment="Left"/>
            <Button  Grid.Row="3" Name="ButtonEditMembers" Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding EditProjectMembers}" TabIndex="4" Content="Edit Members" />

            <DataGrid Grid.Row="4" Name="UserDataGrid" ItemsSource="{Binding Project.Users}"  Style="{StaticResource DataGridStyle}" Width="{Binding ElementName=Grid, Path=ActualWidth}"
                      AutoGenerateColumns="False" IsReadOnly="True" IsSynchronizedWithCurrentItem="True" SelectionMode="Single" SelectionUnit="FullRow">
                <DataGrid.Columns>
                    <DataGridTextColumn Width="*" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding FullName}" Header="Name" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                    <DataGridTextColumn Width="*" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding Email}" Header="E-mail" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                    <DataGridTextColumn Width="Auto" MinWidth="125" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding Organization.Name}" Header="Organization" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                </DataGrid.Columns>
            </DataGrid>

            <!--Display added research questions-->
            <Label Grid.Row="5" Content="Research Questions" Style="{StaticResource InformationCaption}" HorizontalAlignment="Left"/>
            <Button Grid.Row="5" Name="ButtonEditQuestions" Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding EditProjectQuestions}" TabIndex="5" Content="Edit Questions" />

            <DataGrid Grid.Row="6" Name="ResearchQuestionsDataGrid" ItemsSource="{Binding Project.ResearchQuestions}"  Style="{StaticResource DataGridStyle}" Width="{Binding ElementName=Grid, Path=ActualWidth}"
                      AutoGenerateColumns="False" IsReadOnly="True" IsSynchronizedWithCurrentItem="True" SelectionMode="Single" SelectionUnit="FullRow">
                <DataGrid.Columns>
                    <DataGridTextColumn Width="Auto" MinWidth="125" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding QuestionID}" Header="ID" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                    <DataGridTextColumn Width="*" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding Question}" Header="Question" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                    <DataGridTextColumn Width="Auto" MinWidth="125" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding Rational}" Header="Rational" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                </DataGrid.Columns>
            </DataGrid>

            <!--Display added search strings-->
            <Label Grid.Row="7" Content="Search Strings" Style="{StaticResource InformationCaption}" HorizontalAlignment="Left"/>
            <Button Grid.Row="7" Name="ButtonEditStrings" Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding EditProjectSearchStrings}" TabIndex="6" Content="Edit Strings" />

            <DataGrid Grid.Row="8" Name="SearchStringsDataGrid" ItemsSource="{Binding Project.SearchStrings}"  Style="{StaticResource DataGridStyle}" Width="{Binding ElementName=Grid, Path=ActualWidth}"
                      AutoGenerateColumns="False" IsReadOnly="True" IsSynchronizedWithCurrentItem="True" SelectionMode="Single" SelectionUnit="FullRow">
                <DataGrid.Columns>
                    <DataGridTextColumn Width="*" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding SearchString}" Header="SearchString" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                    <DataGridTextColumn Width="*" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding Comment}" Header="Comment" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                    <DataGridTextColumn Width="Auto" MinWidth="125" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding Classification}" Header="Classification" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                </DataGrid.Columns>
            </DataGrid>

            <!--Display added search keywords-->
            <Label Grid.Row="9" Content="Search Keywords" Style="{StaticResource InformationCaption}" HorizontalAlignment="Left"/>
            <Button Grid.Row="9" Name="ButtonEditKeywords" Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding EditProjectSearchKeywords}" TabIndex="7" Content="Edit Keywords" />

            <ListBox Grid.Row="10" Name="SearchKeywordsDataGrid" ItemsSource="{Binding Project.SearchKeywords}"
                       IsSynchronizedWithCurrentItem="True" SelectionMode="Single">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>


            <!--Display project Stages-->
            <Label Grid.Row="11" Content="Project Stages" Style="{StaticResource InformationCaption}" HorizontalAlignment="Left"/>
            <Button Grid.Row="11" Name="ButtonEditStages" Style="{StaticResource LoginBoxButtonStyle}" Command="{Binding EditProjectStages}" TabIndex="8" Content="Edit Stages" />

            <DataGrid Grid.Row="12" Name="StagessDataGrid" ItemsSource="{Binding Project.Stages}"  Style="{StaticResource DataGridStyle}" Width="{Binding ElementName=Grid, Path=ActualWidth}"
                      AutoGenerateColumns="False" IsReadOnly="True" IsSynchronizedWithCurrentItem="True" SelectionMode="Single" SelectionUnit="FullRow">
                <DataGrid.Columns>
                    <DataGridTextColumn Width="Auto" MinWidth="125" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding Stage}" Header="Stage" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                    <DataGridTextColumn Width="*" HeaderStyle="{StaticResource DgchStyle}" Binding="{Binding Description}" Header="Description" ElementStyle="{StaticResource DataGridTextColumnElementStyle}"/>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
    </ScrollViewer>
</UserControl>
